/******************************************************************************
 Copyright (c) 2021 - 2024 Qualcomm Technologies International, Ltd.
 All Rights Reserved.
 Qualcomm Technologies International, Ltd. Confidential and Proprietary.

******************************************************************************/
#include "gatt_mcs_client_handover.h"

#include "mcp_common.h"
#include "mcp_debug.h"
#include "mcp_handover.h"
#ifndef EXCLUDE_GATT_OTS_CLIENT_MODULE
#include "gatt_ots_client_handover.h"
#endif /* EXCLUDE_GATT_OTS_CLIENT_MODULE */

bool McpHandoverVeto(ServiceHandle mcpProfileHandle)
{
    MCP *mcpInst = FIND_MCP_INST_BY_PROFILE_HANDLE(mcpProfileHandle);

    if (mcpInst)
    {
        if (gattMcsClientHandoverVeto(mcpInst->mcsSrvcHndl) || 
           SynergySchedMessagesPendingForTask(CSR_BT_MCP_IFACEQUEUE, NULL) != 0)
        {
            MCP_DEBUG("McpHandoverVeto-MCS");
            return TRUE;
        }
#ifndef EXCLUDE_GATT_OTS_CLIENT_MODULE
        if (gattOtsClientHandoverVeto(mcpInst->otsSrvcHndl))
        {
            MCP_DEBUG("McpHandoverVeto-OTS");
            return TRUE;
        }
#endif /* EXCLUDE_GATT_OTS_CLIENT_MODULE */
    }

    return FALSE;
}
